Tolerate missing X-RateLimit-Remaining for custom base URLs (GHE) - #18
Merged
Merged
Conversation
GitHub Enterprise (a custom base_url) can return a successful 200 without the X-RateLimit-Remaining header when rate limiting is disabled. rate_throttling treated the missing header as a bad base URL and raised GithubException, breaking discovery against Enterprise instances. Pass base_url into rate_throttling and only raise on a missing header for the default github.com domain; for a custom base_url, skip throttling. Bump 2.0.16. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Discovery against a GitHub Enterprise instance (a custom
base_url) fails even though the API call succeeds:The request returns 200, but the Enterprise instance has rate limiting disabled and does not send the
X-RateLimit-Remainingresponse header.rate_throttlingassumed a missing header means a bad base URL and raised — a false positive.Change
rate_throttlingnow takesbase_urland only raises on a missingX-RateLimit-Remainingheader when the base URL is the defaulthttps://api.github.com. For a custom base URL (GitHub Enterprise), a missing header is expected on success, so throttling is skipped.tap_github/client.py: addbase_urlparam (defaults toDEFAULT_DOMAIN);authed_get_single_pagepassesself.base_url.tests/unittests/test_rate_limit.py: add a case asserting no raise when the header is absent and a custom base URL is used (the existing default-domain case still raises).2.0.15->2.0.16.